﻿using B.S.Procurement.Error;
using B.S.Procurement.Write.Api.Application.Command.SaleCommand;
using MediatR;
using Microsoft.AspNetCore.Mvc;

namespace B.S.Procurement.Write.Api.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class SaleController : ControllerBase
    {
        private readonly IMediator mediator;

        public SaleController(IMediator mediator)
        {
            this.mediator = mediator;
        }

        /// <summary>
        /// 添加销售合同
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public Task<ApiResult<int>> Handle(CreateSaleCommand request)
        {
            return mediator.Send(request);
        }
    }
}
